import 'package:catguard/global/global_data.dart';
import 'package:catguard/http/api.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get_storage/get_storage.dart';

class UserUtils {
  static loginOut() async {
    EasyLoading.show(status: 'loading...');
    await Api.logout();
    EasyLoading.dismiss();
    GetStorage box = GetStorage();
    box.remove("token");
    box.remove("userInfo");
    global.userId.value = "0";
  }

  static isLogin() {
    final box = GetStorage();
    String? token = box.read("token");
    // //
    // token="d1a07db4810bead091c5b114af0102aa";
    // prefs.setString("token",token);
    // //
    if (token != null) {
      return true;
    } else {
      return false;
    }
  }
}
